<template>
	<div>
		<el-dialog title="提示" :visible.sync="dialogVisible" width="30%" top="15%" :show-close="false" :close-on-click-modal="false" append-to-body>
			<span>当前多个商户手机号和密码一样，请选择您要进入的商户后台</span>
			<el-select v-model="optionValue" value-key="id" placeholder="请选择商户">
				<el-option v-for="item in option" :label="item.businessName" :value="item" :key="item.id"></el-option>
			</el-select>
			<span slot="footer" class="dialog-footer">
				<el-button @click="dialogVisible = false">取 消</el-button>
				<el-button type="primary" :disabled="!optionValue" @click="submit">进入</el-button>
			</span>
		</el-dialog>
	</div>
</template>

<script>
export default {
	data() {
		return {
			// 配置
			dialogVisible: false,
			// 数据
			optionValue: '',
			option: ''
		};
	},
	methods: {
		open(data) {
			let obj = [];
			data.forEach(el => {
				obj.push(el);
			});
			this.option = obj;
			this.dialogVisible = true;
		},
		submit() {
			this.dialogVisible = false;
			this.$emit('subData', this.optionValue);
		}
	}
};
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.el-select {
	width: 100%;
	margin-top: 16px;
}
</style>
